﻿/*
 * $Revision: 1.1 $ $Date: 2009/05/26 05:02:26 $
 */
package net.wangit.app;

import net.wangit.Row;
import net.wangit.User;
import net.wangit.context.ActionContext;
import net.wangit.support.ElementWriter;
import net.wangit.util.Checker;
import net.wangit.view.element.ElementComponent;

public class UserNameElementWriter implements ElementWriter {

  public void write(ActionContext ac, StringBuffer html, ElementComponent ec,
      Row row) {
    User user = ac.getVisitor().getUser();
    String userName = user.get("username");
    html.append(Checker.isEmpty(userName) ? user.getId() : userName);

  }

}
